package test4;
//实例内部类
class OuterClass{
    public int data1=1;
    private int data2=2;
    public static int data3=3;

    //实例内部类，可以当做外部类的一个普通实例的成员
    class InnerClass{
        public int data1=9999;
        public int data4=4;
        private int data5=5;
        public static final int data6=6;
        public InnerClass(){
            System.out.println("不带参数的内部类的构造方法");
        }
        public void test(){
            System.out.println(OuterClass.this.data1);
            System.out.println(this.data1);
            System.out.println(data2);
            System.out.println(data3);
            System.out.println(data4);
            System.out.println("InnerClass::test()");
        }
    }

    public void func1(){
        System.out.println("OuterClass::func1()");
    }
}

public class Demo2 {
    public static void main(String[] args) {
        OuterClass outerClass=new OuterClass();
        OuterClass.InnerClass innerClass=outerClass.new InnerClass();
        innerClass.test();
    }
}
